package cn.clickmed.DaTong;

import android.content.Context;
import android.widget.Toast;

public class ToastHelper {
    private static volatile ToastHelper sInstance;

    private Toast mToast;

    public static ToastHelper getInstance() {
        if (sInstance == null) {
            synchronized (ToastHelper.class) {
                if (sInstance == null) {
                    sInstance = new ToastHelper();
                }
            }
        }
        return sInstance;
    }

    public void showToast(Context context, String msg) {
        if (mToast != null) {
            mToast.cancel();
            mToast = null;
        }
        mToast = Toast.makeText(context, msg, Toast.LENGTH_LONG);
        mToast.show();
    }
}
